Content starts here ALDSP Functions and Procedures
This page last changed on Nov 26, 2007.

ALDSP Functions and Procedures

Data Services support fundamentally two types of functional operations: functions and procedures. Both Entity data services and Library data services can have these types of operations.

A key concept is an operation with (or without) side-effects. In this context a side-effect should be understood to mean that the operation could have an effect other than returning data in a particular XML shape. 

Operations Without Side Effects

Operations that have no side effects are declared as 'functions'. A function can be implemented in three ways:

  • XQuery language
  • XQSE language
  • External

An additional qualifier is added to function declaration to denote the language implementation for the function. Lack of this qualifier means that the function is implemented in XQuery language. In other words, XQuery is the default language implementation for functions.

XQuery and XQSE function Interaction

A function 'A' can invoke any other function 'B'. The language of implementation of function 'B' is not relevant. However, a function cannot invoke a procedure.

Prototype Function Declarations 

Here are several prototypes of function declarations:

declare function foo(....) {...};

declare XQSE function foo(....);

declare function foo(....) external;

Prototype Procedure Declarations

Functional operations that may have side effects must be declared as procedures. A procedure can be implemented by XQSE language or external. A procedure can invoke other procedures or functions. Here are two examples of procedure declarations:

declare procedure foo(...) {...};

declare procedure foo(...) external;
Document generated by Confluence on Apr 28, 2008 15:54